﻿using System;
using System.Linq;
using System.Text;
using System.Activities;
using System.Activities.Expressions;
using System.Activities.Presentation.PropertyEditing;
using System.Activities.Statements;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using Entities = Vision.Core.Entities;
using Components = Vision.Core.Components;

namespace Vision.Core.ActivityComponents.Configuration
{
    /// <summary>
    /// 
    /// </summary>
    public class GetConfigSetting : CodeActivity
    {
        /// <summary>
        /// 
        /// </summary>
        public InArgument<string> SettingName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public OutArgument<string> SettingValue { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            string value = string.Empty;
            if (ConfigurationManager.AppSettings[this.SettingName.Get(context)] != null){
                value = ConfigurationManager.AppSettings[this.SettingName.Get(context)];    
            }

            this.SettingValue.Set(context, value);            
        }
    }
}
